home *** CD-ROM | disk | FTP | other *** search
- /********************************************************************************
-
- Gnucleus - A node application for the Gnutella network
- Copyright (C) 2000 John Marshall
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- For support, questions, comments, etc...
- E-Mail:
- swabby@c0re.net
-
- Address:
- 21 Cadogan Way
- Nashua, NH, USA 03062
-
- ********************************************************************************/
-
-
- #ifndef _CLISTCTRLEX_H_
- #define _CLISTCTRLEX_H_
-
- #include "TitleTip.h"
- #include "HeaderCtrlEx.h"
-
- #define LVNU_SELCHANGED 0x1000
-
- class CListCtrlEx : public CListCtrl
- {
-
- DECLARE_DYNCREATE(CListCtrlEx)
-
- // Construction
- public:
- CListCtrlEx();
- virtual ~CListCtrlEx();
- void DragColumn(int source, int dest);
- int GetColumnNumber( char *title );
- int HitTestEx(CPoint &point, int *col) const;
-
- BOOL SetItemText( int nItem, int nSubItem, LPCTSTR lpszText );
-
- int GetNColumns();
- CString GetColumnTitle( int n );
-
- // Attributes
- protected:
- CMyHeaderCtrl m_headerctrl;
- BOOL m_bFullRowSel;
- BOOL m_bClientWidthSel;
-
- BOOL m_bDrawGrid;
-
- // For column sorting.
- int nSortedCol;
- BOOL bSortAscending;
- CToolTipCtrl m_tooltip;
-
-
- public:
- BOOL SetFullRowSel(BOOL bFillRowSel);
- BOOL GetFullRowSel();
- void SetDrawGrid( BOOL bDrawGrid );
- BOOL GetDrawGrid();
- CEdit* EditSubLabel( int nItem, int nCol );
-
- // Overrides
- protected:
- virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
-
- // ClassWizard generated virtual function overrides
- //{{AFX_VIRTUAL(CListCtrlEx)
- public:
- virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
- virtual BOOL PreTranslateMessage(MSG* pMsg);
- protected:
- virtual void PreSubclassWindow();
- //}}AFX_VIRTUAL
-
- // Implementation
- public:
- void EnableGenericSort(BOOL _use_generic = TRUE);
- #ifdef _DEBUG
- virtual void Dump(CDumpContext& dc) const;
- #endif
-
- protected:
- void RepaintSelectedItems();
-
- // Implementation - list view colors
- COLORREF m_clrText;
- COLORREF m_clrTextBk;
- COLORREF m_clrBkgnd;
- CTitleTip m_titletip;
-
- afx_msg LRESULT OnSetTextColor(WPARAM wParam, LPARAM lParam);
- afx_msg LRESULT OnSetTextBkColor(WPARAM wParam, LPARAM lParam);
- afx_msg LRESULT OnSetBkColor(WPARAM wParam, LPARAM lParam);
-
- bool HitTestRowCol(CPoint& point, int& iRow, int& iColumn);
- CRect GetCellRect(int iRow, int iColumn)const;
-
- int GetTrueColumnWidth(int nCurrentPosition)const;
- CString GetTrueItemText(int row, int col)const;
- void HideTitleTip();
- void SendSelChangedNotification();
- void ShowTitleTip(CPoint point);
- void OnHeaderClicked(NMHDR* pNMHDR, LRESULT* pResult);
- BOOL SortTextItems( int nCol, BOOL bAscending, int low = 0, int high = -1);
-
- // Generated message map functions
- protected:
- BOOL m_bUseGenericSort;
- //{{AFX_MSG(CListCtrlEx)
- afx_msg void OnPaint();
- afx_msg void OnSetFocus(CWnd* pOldWnd);
- afx_msg void OnKillFocus(CWnd* pNewWnd);
- afx_msg void OnMouseMove(UINT nFlags, CPoint point);
- afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
- afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
- afx_msg void OnDestroy();
- afx_msg void OnEndlabeledit(NMHDR* pNMHDR, LRESULT* pResult);
- //}}AFX_MSG
- DECLARE_MESSAGE_MAP()
- };
-
- /////////////////////////////////////////////////////////////////////////////
- #endif
-